<html>
<head>
<title></title>
<!-- this file saves the media list that was chosen with the Save_Media.php -->
<link rel="stylesheet" type="text/css" href="css/Default.css" />
<Script language="javascript" src="data/password.js"></script>
<Script language="javascript" src="exec/login.js"></script>
<noscript>
location.href="noscript.html";
</noscript>
<SCRIPT LANGUAGE="JavaScript">

	window.onload = redir(0);

//name of cookie: 'eomdmf'

</SCRIPT>
</head>
<body >
<?php

//import form information 
$playlist_m = $_POST['Playlist_M'];
echo "<!--\n".$playlist_m;

$playlist_p = $_POST['Playlist_P'];
echo "\n".$playlist_p."-->";

?>
<table height="100%" width="100%" border="0">
<tr>
<td>
<center>
	<p style="font-family: Arial; font-size:20px"> Your playlist has been saved.</p>
	
	<FORM METHOD="LINK" ACTION="index.html">
	<INPUT TYPE="submit" VALUE="Home Page">
	</FORM>	
<FORM METHOD="LINK" ACTION="LoggedIn.php">
<INPUT TYPE="submit" VALUE="Return to Main Menu">
</FORM>
</center>
</td>
</tr>
</table>
<?php
//save videos to file
$fh = fopen("data/playlist_v.txt", "w+");
if($fh==false)
	die("unable to create file");
$i=0;
	fwrite($fh,$playlist_m);
fclose($fh);

//seperate playlists, between video + pictures

$fh = fopen("data/playlist_p.txt", "w+");

if($fh==false)
	die("unable to create file");
$i=0;
	fwrite($fh,$playlist_p);
fclose($fh);
	
/*
//This code is for using the playerdiy flash player, which can not handle images, this only sets up the playlist for it.


$playlist_m = explode("\n", $playlist_m);
$playlist_p = explode("\n", $playlist_p);


<?xml version="1.0" encoding="UTF-8" ?>
<playlist>
<playitem caption="YrbkAd.avi" path="YrbkAd.avi.flv" image="YrbkAd.avi.jpg" options="" clickurl="" clicktarget="_blank" endurl="" styleoftarget="browser" endtarget="" /> 
<playitem caption="flowplayer-700.flv" path="flowplayer-700.flv.flv" image="flowplayer-700.flv.jpg" options="" clickurl="" clicktarget="_blank" endurl="" styleoftarget="browser" endtarget="" /> 
</playlist



$fh = fopen("player/medialist.xml", "w+");
if($fh==false)
	die("unable to create file");
$i=0;
fwrite( $fh, "<?xml version='1.0' encoding='UTF-8' ?>\n\r<playlist>\n" );
while($i < sizeof($playlist_m) ){
//this is what we have to write to get the medai to play.
	$playlist_m[$i] = str_replace("\n", "", $playlist_m[$i]);
	$playlist_m[$i] = str_replace("\r", "", $playlist_m[$i]);
	if( strlen($playlist_m[$i]) > 1 ){
		fwrite( $fh, "\n<playitem caption=\"$playlist_m[$i]\" path=\"$playlist_m[$i]\" image=\"media/Gold_Lion.jpg\" options=\"\" clickurl=\"\" clicktarget=\"_blank\" endurl=\"\" styleoftarget=\"browser\" endtarget=\"\" />" );
	}
		$i++;
}


$i=0;
//seperate playlists, between video + pictures
while($i < sizeof($playlist_p) ){
//this is what we have to write to get the medai to play.
	$playlist_p[$i] = str_replace("\n", "", $playlist_p[$i]);
	$playlist_p[$i] = str_replace("\r", "", $playlist_p[$i]);
	if( strlen($playlist_m[$i]) > 1 ){
		fwrite( $fh, "\n<playitem caption=\"$playlist_p[$i]\" path=\"$playlist_p[$i]\" image=\"media/Gold_Lion.jpg\" options=\"\" clickurl=\"\" clicktarget=\"_blank\" endurl=\"\" styleoftarget=\"browser\" endtarget=\"\" />" );
	}
	$i++;
}
fwrite( $fh, "</playlist>" );
fclose($fh);
*/

?>
</body>
</html>